﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows;

namespace PresentItNow
{
    public class ModeToVisibilityConverter : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (!(value is OperationMode))
                return null;

            OperationMode currentMode = (OperationMode)value;
            string visibleModeString = parameter.ToString();
            OperationMode visibleMode = (OperationMode)Enum.Parse(typeof(OperationMode), visibleModeString);

            if (currentMode == visibleMode)
                return Visibility.Visible;

            return Visibility.Collapsed;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
